package com.ruoyi.blogs.service.impl;

import java.util.List;

import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.blogs.mapper.BsUserFollowMapper;
import com.ruoyi.blogs.domain.BsUserFollow;
import com.ruoyi.blogs.service.IBsUserFollowService;

/**
 * 用户关注关系Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-12-09
 */
@Service
public class BsUserFollowServiceImpl implements IBsUserFollowService 
{
    @Autowired
    private BsUserFollowMapper bsUserFollowMapper;

    /**
     * 查询用户关注关系
     * 
     * @param id 用户关注关系主键
     * @return 用户关注关系
     */
    @Override
    public BsUserFollow selectBsUserFollowById(Long id)
    {
        return bsUserFollowMapper.selectBsUserFollowById(id);
    }

    /**
     * 查询用户关注关系列表
     * 
     * @param bsUserFollow 用户关注关系
     * @return 用户关注关系
     */
    @Override
    public List<BsUserFollow> selectBsUserFollowList(BsUserFollow bsUserFollow)
    {
        return bsUserFollowMapper.selectBsUserFollowList(bsUserFollow);
    }

    /**
     * 新增用户关注关系
     * 
     * @param bsUserFollow 用户关注关系
     * @return 结果
     */
    @Override
    public int insertBsUserFollow(BsUserFollow bsUserFollow)
    {
        bsUserFollow.setCreateTime(DateUtils.getNowDate());
        bsUserFollow.setUpdateTime(DateUtils.getNowDate());
        return bsUserFollowMapper.insertBsUserFollow(bsUserFollow);
    }

    /**
     * 修改用户关注关系
     * 
     * @param bsUserFollow 用户关注关系
     * @return 结果
     */
    @Override
    public int updateBsUserFollow(BsUserFollow bsUserFollow)
    {
        bsUserFollow.setUpdateTime(DateUtils.getNowDate());
        return bsUserFollowMapper.updateBsUserFollow(bsUserFollow);
    }

    /**
     * 批量删除用户关注关系
     * 
     * @param ids 需要删除的用户关注关系主键
     * @return 结果
     */
    @Override
    public int deleteBsUserFollowByIds(Long[] ids)
    {
        return bsUserFollowMapper.deleteBsUserFollowByIds(ids);
    }

    /**
     * 删除用户关注关系信息
     * 
     * @param id 用户关注关系主键
     * @return 结果
     */
    @Override
    public int deleteBsUserFollowById(Long id)
    {
        return bsUserFollowMapper.deleteBsUserFollowById(id);
    }

    @Override
    public List<SysUser> selectUserListByFollow(BsUserFollow bsUserFollow) {
        return bsUserFollowMapper.selectUserListByFollow(bsUserFollow);
    }

    @Override
    public List<SysUser> selectUserListByFans(BsUserFollow bsUserFollow) {
        return bsUserFollowMapper.selectUserListByFans(bsUserFollow);
    }
}
